<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增来源基本')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-baseInfo-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">渠道编号：</label>
                <div class="col-sm-8">
                    <input name="channelCode" class="form-control" type="text" required>
                    <small class="text-muted">请输入已经创建的渠道的编号</small>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">对接类型：</label>
                <div class="col-sm-8">
                    <select class="form-control"  name="type">
                        <option th:each="item:${infoTypeList}" th:value="${item.value}" th:text="${item.name}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">描述信息：</label>
                <div class="col-sm-8">
                    <input name="descInfo" class="form-control" type="text" required>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">价格类型：</label>
                <div class="col-sm-8">
                    <select class="form-control"  name="priceType">
                        <option th:each="item:${priceTypeList}" th:value="${item.value}" th:text="${item.name}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">渠道价格：</label>
                <div class="col-sm-8">
                    <input name="priceAmount" class="form-control" type="text" required>
                    <small class="text-muted">分润类型可填0</small>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">溢价率：</label>
                <div class="col-sm-8">
                    <input name="priceRate" class="form-control" type="text" required>
                    <small class="text-muted">该渠道 推送价格 >= 渠道价格*溢价率。分润渠道全价格推送。</small>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">收益分成比例：</label>
                <div class="col-sm-8">
                    <input name="profitRate" class="form-control" type="text">
                    <small class="text-muted">分润类型必填，固价不必填；我方分成比例，例如：0.2(代表2/8分成，我方分成20%)</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">撞库成功最低价：</label>
                <div class="col-sm-8">
                    <input name="checkMinAmount" class="form-control" type="text">
                    <small class="text-muted">分润类型必填，固价不必填；例如：10(撞库订单给上游结算小于10元时，直接返回给上游撞库失败)</small>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">撞库超时时间：</label>
                <div class="col-sm-8">
                    <input name="checkTimeout" class="form-control" type="text" required value="3000">
                    <small class="text-muted">该渠道撞库执行时间，超时直接返回撞库失败</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">进件超时时间：</label>
                <div class="col-sm-8">
                    <input name="registerTimeout" class="form-control" type="text" required>
                    <small class="text-muted">该渠道进件执行时间，超时直接返回进件失败</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">对比价格开关：</label>
                <div class="col-sm-8">
                    <select name="comparePrice" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                    <small class="text-muted">关闭比价则取最快返回撞库成功的下游，打开则根据比价数量对比价格最高的撞库结果</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">对比价格数量：</label>
                <div class="col-sm-8">
                    <input name="compareNum" class="form-control" type="text" required>
                    <small class="text-muted">开启了比价开关，则按此处设置的比价数量进行对比</small>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">价格百分比：</label>
                <div class="col-sm-8">
                    <input name="priceReductionPercentage" class="form-control" type="text" value="0.00" required>
                    <small class="text-muted">价格百分比</small>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "source/baseInfo"
        $("#form-baseInfo-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-baseInfo-add').serialize());
            }
        }
    </script>
</body>
</html>